pretty_var_name <- function(i)
{
  pretty_var_name_table <- data.frame(UglyVar=c("Transnational", "HousingMed", "HousingPctIncrease", "Ideology", "Education_hi", "Education_lo", 
                                                "GreatestCountry",
                                                paste0("factor(State)", c("AK", "CA", "FL", "MA", "MD", "NC", "NJ", "NY", "TX", "VA")),
                                                "Gender", paste0("factor(Education)", 2:6), "Age", "T1", "T2", "T3", "Costs", 
                                                "(Intercept)", paste0("M", 1:6)),
                                      PrettyVar=c("Transnational", "Housing value", "Housing price increase", "Ideology", "Education, high", "Education, low", 
                                                  "'US greatest country'", 
                                                  paste0("State: ", c("AK", "CA", "FL", "MA", "MD", "NC", "NJ", "NY", "TX", "VA")),
                                                  "Gender", "Ed: High school",
                                                  "Ed: some college", "Ed: 2-yr college", "Ed: B.A./B.S.", "Ed: graduate degree", "Age",
                                                  "T: local, no Senator", "T: local, Senator", "T: non-local, Senator", "Costs", "Intercept",
                                                  paste0("M", 1:6)),
                                      stringsAsFactors = FALSE)
  
  y_out <- rep(NA, length(i))
  i_tmp <- unique(i)
  
  for(j in 1:length(i_tmp))
  {
    tmp <- subset(pretty_var_name_table, UglyVar == i_tmp[j])$PrettyVar
    y_out[i == i_tmp[j]] <- tmp
  }
  
  return(y_out)
}
                  

